home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / SmallEiffel 0.3.3 / SmallEiffel 68k / diff / lib_std.old < prev    next >
Encoding:
Text File  |  1996-06-13  |  27.1 KB  |  868 lines  |  [TEXT/EDIT]

  1.        require
  2. >      size > 0
  3. >       do           
  4. >      c_inline_c("R=realloc(a1,%
  5. >              %((size_t)(a2*sizeof(*(C->_storage)))));");
  6. >       end;
  7. >    free_pointer(p: POINTER) is
  8. >       require
  9. >      p.is_not_void
  10. >       external "C"
  11. >       alias "free"
  12. >       end;
  13. > feature {ARRAY}
  14. >    free_array is
  15. >       external "CWC"
  16. >       alias "free"
  17. >       end;
  18. 326c357,359
  19. <       
  20. ---
  21. >    capacity > 0 implies storage.is_not_void;
  22. diff -r lib_std/array.e /users/prof/colnet/SmallEiffel/lib_std/array.elib_std/boolean.e /users/prof/colnet/SmallEiffel/lib_std/boolean.e
  23. 20c20,21
  24. <       external "CSE"
  25. ---
  26. >       do
  27. >      Result := Current and then other;
  28. 35c36,37
  29. <       external "CSE"
  30. ---
  31. >       do
  32. >      Result := Current or else other;
  33. 55c57,61
  34. <       external "CSE"
  35. ---
  36. >       do
  37. >      if Current then
  38. >      else
  39. >         Result := true;
  40. >      end;
  41. diff -r lib_std/boolean.e /users/prof/colnet/SmallEiffel/lib_std/boolean.elib_std/boolean_ref.e /users/prof/colnet/SmallEiffel/lib_std/boolean_ref.e
  42. 11,12c11
  43. < creation {ANY}
  44. <     make
  45. ---
  46. > creation make
  47. 14c13
  48. < feature {ANY}
  49. ---
  50. > feature 
  51. 22a22,28
  52. >       end;
  53. > feature
  54. >    
  55. >    set_item(value: like item) is
  56. >       do
  57. >      item := value;
  58. diff -r lib_std/boolean_ref.e /users/prof/colnet/SmallEiffel/lib_std/boolean_ref.elib_std/character.e /users/prof/colnet/SmallEiffel/lib_std/character.e
  59. 22c22
  60. <    infix "<"(other: CHARACTER): BOOLEAN is
  61. ---
  62. >    infix "<" (other: CHARACTER): BOOLEAN is
  63. 24c24,25
  64. <       external "CSE"
  65. ---
  66. >       do
  67. >      Result := code < other.code;
  68. 29c30,31
  69. <       external "CSE"
  70. ---
  71. >       do
  72. >      Result := code <= other.code;
  73. 34c36,37
  74. <       external "CSE"
  75. ---
  76. >       do
  77. >      Result := code > other.code;
  78. 39c42,43
  79. <       external "CSE"
  80. ---
  81. >       do
  82. >      Result := code >= other.code;
  83. 62c66
  84. <    same_as(other : CHARACTER): BOOLEAN is
  85. ---
  86. >    same_as(other: CHARACTER): BOOLEAN is
  87. 65c69,80
  88. <      Result := to_lower = other.to_lower;
  89. ---
  90. >      if Current = other then
  91. >         Result := true;
  92. >      else
  93. >         inspect
  94. >            code
  95. >         when 65 .. 90 then
  96. >            Result := Current = other.to_upper;
  97. >         when 97 .. 122 then
  98. >            Result := Current = other.to_lower;
  99. >         else
  100. >         end;
  101. >      end;
  102. diff -r lib_std/character.e /users/prof/colnet/SmallEiffel/lib_std/character.elib_std/character_ref.e /users/prof/colnet/SmallEiffel/lib_std/character_ref.e
  103. 8,9c8
  104. < creation {ANY}
  105. <    make
  106. ---
  107. > creation make
  108. 11c10
  109. < feature {ANY}
  110. ---
  111. > feature 
  112. 19a19,25
  113. > feature
  114. >    
  115. >    set_item(value: like item) is
  116. >       do
  117. >      item := value;
  118. >       end;
  119. diff -r lib_std/character_ref.e /users/prof/colnet/SmallEiffel/lib_std/character_ref.elib_std/double_ref.e /users/prof/colnet/SmallEiffel/lib_std/double_ref.e
  120. 17,18c17
  121. < creation {ANY}
  122. <    make
  123. ---
  124. > creation make
  125. 20c19
  126. < feature {ANY}
  127. ---
  128. > feature 
  129. 28a28,34
  130. > feature
  131. >    
  132. >    set_item(value: like item) is
  133. >       do
  134. >      item := value;
  135. >       end;
  136. diff -r lib_std/double_ref.e /users/prof/colnet/SmallEiffel/lib_std/double_ref.elib_std/fixed_array.e /users/prof/colnet/SmallEiffel/lib_std/fixed_array.e
  137. 20c20
  138. <    make, resize
  139. ---
  140. >    make, resize, from_collection
  141. 41a42,43
  142. >       local
  143. >      model: like item;
  144. 43,44c45,48
  145. <      if storage /= Void then
  146. <         c_inline_c("free(C->_storage);");
  147. ---
  148. >      if storage.is_not_void then
  149. >         storage := realloc(storage,size,model);
  150. >      else
  151. >         storage := malloc(size,model);
  152. 46,47d49
  153. <      c_inline_c("C->_storage=malloc(((size_t)%
  154. <             %sizeof(*(C->_storage))*a1));");
  155. 53a56,74
  156. >    from_collection(cltn: COLLECTION[E]) is
  157. >       local
  158. >      fa_index, cltn_index: INTEGER;
  159. >       do
  160. >      from
  161. >         make(cltn.count);
  162. >         fa_index := upper;
  163. >         cltn_index := cltn.upper;
  164. >      until
  165. >         fa_index < 0
  166. >      loop
  167. >         put(cltn.item(cltn_index),fa_index);
  168. >         cltn_index := cltn_index - 1;
  169. >         fa_index := fa_index - 1;
  170. >      end;
  171. >       ensure
  172. >      count = cltn.count
  173. >       end;
  174. 59c80,81
  175. <      c_inline_c("R=(C->_storage)[a1];")
  176. ---
  177. >      if storage = Void then end;
  178. >      c_inline_c("R=((C->_storage)[a1]);")
  179. 66c88
  180. <      c_inline_c("(C->_storage)[a2]=a1;");
  181. ---
  182. >      c_inst(1);
  183. ---
  184. >      p := cmd.to_external;
  185. >      c_inline_c("system(((char*)_p));");
  186. 519c571
  187. <      -- Statically computed by SmallEiffel.
  188. ---
  189. >      -- Target is not evaluated (Statically computed).
  190. 521d572
  191. <      -- Target is not evaluated.
  192. 525a577,586
  193. >    frozen is_basic_expanded_type: BOOLEAN is
  194. >      -- Target is not evaluated (Statically computed).
  195. >      -- Result is true if target static type is one of the 
  196. >      -- following types : BOOLEAN, CHARACTER, INTEGER, REAL,
  197. >      -- DOUBLE or POINTER.
  198. >       external "CSE"
  199. >       ensure
  200. >      Result implies is_expanded_type
  201. >       end;
  202. >    
  203. 529,530c590
  204. <      -- The result is the C sizeof of the corresponding
  205. <      -- struct or basic object.
  206. ---
  207. >      -- The result is given in number of CHARACTER.
  208. 552a613,625
  209. >       end;
  210. > feature -- WARNING: For SmallEiffel Gurus's only. 
  211. >    -- Internal implementation of the SmallEiffel 
  212. >    -- debugger/interpretor (command `eval').
  213. >    eval_read_attribute(name: STRING; dest: POINTER) is do end;
  214. >    eval_write_attribute(name: STRING; source: POINTER) is do end;
  215. >    frozen eval_virtual_machine: EVAL_VIRTUAL_MACHINE is
  216. >       once
  217. >      !!Result.make;
  218. diff -r lib_std/general.e /users/prof/colnet/SmallEiffel/lib_std/general.elib_std/integer.e /users/prof/colnet/SmallEiffel/lib_std/integer.e
  219. 11,13c11,14
  220. <      infix "+", infix "-", infix "*", infix "/", infix "\\", infix "//", 
  221. <      infix "^", infix "<", infix "<=", infix ">", infix ">=", compare, 
  222. <      prefix "-", prefix "+", hash_code, one, zero, print_on
  223. ---
  224. >      infix "+", infix "-", infix "*", infix "/", infix "\\", 
  225. >      infix "//", infix "^", infix "<", infix "<=", infix ">",
  226. >      infix ">=", compare, prefix "-", prefix "+", hash_code, 
  227. >      one, zero, print_on
  228. 74c75
  229. <      -- Is Current smaller than `other'?
  230. ---
  231. >      -- Is 'Current' strictly less than 'other'?
  232. 79c80
  233. <      -- Is Current smaller or equal to `other'?
  234. ---
  235. >      -- Is 'Current' less or equal 'other'?
  236. 84c85
  237. <      -- Is Current greater than `other'?
  238. ---
  239. >      -- Is 'Current' strictly greater than 'other'?
  240. 89c90
  241. <      -- Is Current greater or equal to `other'?
  242. ---
  243. >      -- Is 'Current' greater or equal than 'other'?
  244. 134c135
  245. <      Result := to_real.sqrt;
  246. ---
  247. >      Result := to_double.sqrt;
  248. 176a178,184
  249. >    to_boolean: BOOLEAN is
  250. >       do
  251. >      if Current /= 0 then
  252. >         Result := true;
  253. >      end;
  254. >       end;
  255. 295c303,306
  256. <    tmp_string: STRING is "0000000000000000000";
  257. ---
  258. >    tmp_string: STRING is 
  259. >       once
  260. >      !!Result.make(128);
  261. >       end;
  262. diff -r lib_std/integer.e /users/prof/colnet/SmallEiffel/lib_std/integer.elib_std/integer_ref.e /users/prof/colnet/SmallEiffel/lib_std/integer_ref.e
  263. 17,18c17
  264. < creation {ANY}
  265. <    make
  266. ---
  267. > creation make
  268. 20c19
  269. < feature {ANY}
  270. ---
  271. > feature 
  272. 28a28,34
  273. > feature
  274. >    
  275. >    set_item(value: like item) is
  276. >       do
  277. >      item := value;
  278. >       end;
  279. diff -r lib_std/integer_ref.e /users/prof/colnet/SmallEiffel/lib_std/integer_ref.elib_std/platform.e /users/prof/colnet/SmallEiffel/lib_std/platform.e
  280. 8,9c8
  281. <    
  282. < feature {ANY}
  283. ---
  284. > feature -- Maximum :
  285. 11c10,16
  286. <     Maximum_character_code : INTEGER is 255
  287. ---
  288. >     Maximum_character_code : INTEGER is
  289. >      -- Largest supported code for CHARACTER values.
  290. >       once
  291. >      c_inline_c("R=CHAR_MAX;");
  292. >       ensure
  293. >      meaningful: Result >= 127
  294. >       end;
  295. 13c18,24
  296. < end -- class PLATFORM
  297. ---
  298. >     Maximum_integer: INTEGER is
  299. >       -- Largest supported value of type INTEGER.
  300. >       once
  301. >      c_inline_c("R=INT_MAX;");
  302. >       ensure
  303. >      meaningful: Result >= 0
  304. >       end;
  305. 14a26,127
  306. >     Maximum_real: REAL is
  307. >       -- Largest supported value of type REAL.
  308. >       once
  309. >      c_inline_c("R=FLT_MAX;");
  310. >       ensure
  311. >      meaningful: Result >= 0.0
  312. >       end;
  313. >     Maximum_double: DOUBLE is
  314. >       -- Largest supported value of type DOUBLE.
  315. >       once
  316. >      c_inline_c("R=DBL_MAX;");
  317. >       ensure
  318. >      meaningful: Result >= 0.0
  319. >       end;
  320. > feature -- Minimum :
  321. >    Minimum_character_code: INTEGER is
  322. >       -- Smallest supported code for CHARACTER values.
  323. >       once
  324. >      c_inline_c("R=CHAR_MIN;");
  325. >       ensure
  326. >      meaningful: Result <= 0
  327. >       end;
  328. >    Minimum_integer: INTEGER is
  329. >       -- Smallest supported value of type INTEGER.
  330. >       once
  331. >      c_inline_c("R=INT_MIN;");
  332. >       ensure
  333. >      meaningful: Result <= 0
  334. >       end;
  335. >    Minimum_double: DOUBLE is
  336. >       -- Smallest supported value of type DOUBLE.
  337. >       once
  338. >      Result := - Maximum_double;
  339. >       ensure
  340. >      meaningful: Result <= 0
  341. >       end;
  342. >    Minimum_real: REAL is
  343. >       -- Smallest supported value of type REAL.
  344. >       once
  345. >      Result := - Maximum_real;
  346. >       ensure
  347. >      meaningful: Result <= 0
  348. >       end;
  349. > feature -- Bits :
  350. >    Boolean_bits: INTEGER is
  351. >       -- Number of bits in a value of type BOOLEAN.
  352. >       once
  353. >      c_inline_c("R=(CHAR_BIT*sizeof(int));");
  354. >       ensure
  355. >      meaningful: Result >= 1
  356. >       end;
  357. >    Character_bits: INTEGER is
  358. >       -- Number of bits in a value of type CHARACTER.
  359. >       once
  360. >      c_inline_c("R=CHAR_BIT;");
  361. >       ensure
  362. >      meaningful: Result >= 1;
  363. >      large_enough: (2^Result) >= Maximum_character_code;
  364. >       end;
  365. >    Integer_bits: INTEGER is
  366. >      -- Number of bits in a value of type INTEGER.
  367. >       once
  368. >      c_inline_c("R=(CHAR_BIT*sizeof(int));");
  369. >       ensure
  370. >      meaningful: Result >= 1;
  371. >       end;
  372. >    Real_bits: INTEGER is
  373. >      -- Number of bits in a value of type DOUBLE.
  374. >       once
  375. >      c_inline_c("R=(CHAR_BIT*sizeof(float));");
  376. >       ensure
  377. >      meaningful: Result >= 1;
  378. >      meaningful: Result >= Real_bits;
  379. >       end;
  380. >    Double_bits: INTEGER is
  381. >      -- Number of bits in a value of type DOUBLE.
  382. >       once
  383. >      c_inline_c("R=(CHAR_BIT*sizeof(double));");
  384. >       ensure
  385. >      meaningful: Result >= 1;
  386. >      meaningful: Result >= Real_bits;
  387. >       end;
  388. >    Pointer_bits: INTEGER is
  389. >      -- Number of bits in a value of type REAL.
  390. >       once
  391. >      c_inline_c("R=(CHAR_BIT*sizeof(char *));");
  392. >       end;
  393. > end -- PLATFORM
  394. diff -r lib_std/platform.e /users/prof/colnet/SmallEiffel/lib_std/platform.elib_std/pointer.e /users/prof/colnet/SmallEiffel/lib_std/pointer.e
  395. 9,12c9,18
  396. < -- Note : corresponding C type is usually "void *".
  397. < --    In type STRING, POINTER is mapped "char *".
  398. < --    In type ARRAY and FIXED_ARRAY, POINTER is mapped as the 
  399. < --    C type of the generic actual argument.
  400. ---
  401. > -- Note : corresponding C type is mapped as "void *" except for
  402. > --        source files "string.e", "array.e" and "fixed_array.e".
  403. > --        In file "string.e", type POINTER is simply mapped as
  404. > --        the usual C type "char*".
  405. > --        In files "array.e" and "fixed_array.e", the mapping depends
  406. > --        on the actual generic type. When the actual generic type
  407. > --        is a reference type, POINTER is mapped as C type "T0 **".
  408. > --        When the actual type is an expanded type, POINTER is mapped 
  409. > --        as "<Ti>*" where <Ti> is the corresponding type of expanded
  410. > --        actual generic argument.
  411. 13a20
  412. 19a27,40
  413. >    is_not_void: BOOLEAN is
  414. >      -- Is the external POINTER a non Void pointer ?
  415. >      --  
  416. >      -- NOTE: as POINTER is an expanded class, the Eiffel
  417. >      --       test  Current /= Void is always true.
  418. >      --
  419. >       external "CSE"
  420. >       end;
  421. >    is_void: BOOLEAN is
  422. >       do
  423. >      Result := not is_not_void;
  424. >       end;
  425. diff -r lib_std/pointer.e /users/prof/colnet/SmallEiffel/lib_std/pointer.elib_std/pointer_ref.e /users/prof/colnet/SmallEiffel/lib_std/pointer_ref.e
  426. 10c10,15
  427. < end -- class INTEGER_REF
  428. ---
  429. >    set_item(value: like item) is
  430. >       do
  431. >      item := value;
  432. >       end;
  433. > end -- POINTER_REF
  434. diff -r lib_std/pointer_ref.e /users/prof/colnet/SmallEiffel/lib_std/pointer_ref.elib_std/real_ref.e /users/prof/colnet/SmallEiffel/lib_std/real_ref.e
  435. 17,18c17
  436. < creation {ANY}
  437. <    make
  438. ---
  439. > creation make
  440. 20c19
  441. < feature {ANY}
  442. ---
  443. > feature 
  444. 28a28,34
  445. > feature
  446. >    
  447. >    set_item(value: like item) is
  448. >       do
  449. >      item := value;
  450. >       end;
  451. diff -r lib_std/real_ref.e /users/prof/colnet/SmallEiffel/lib_std/real_ref.elib_std/std_error.e /users/prof/colnet/SmallEiffel/lib_std/std_error.e
  452. 39c39
  453. < feature {NONE}   
  454. ---
  455. > feature {RUN_FEATURE}   
  456. diff -r lib_std/std_error.e /users/prof/colnet/SmallEiffel/lib_std/std_error.elib_std/std_file.e /users/prof/colnet/SmallEiffel/lib_std/std_file.e
  457. 49,50c49
  458. <    -- NOTE: use only a few basic ANSI C functions.
  459. <    -- Try to use a as less as possible external C calls.
  460. ---
  461. >    -- NOTE: use only a few basic external C calls.
  462. 58a58,59
  463. >       local
  464. >      pf, pm: POINTER;
  465. 60,65c61,63
  466. <      f.extend('%U');
  467. <      m.extend('%U');
  468. <      c_inline_c("R=(T0 *)fopen(((Tstring *)a1)->_storage,%
  469. <              %((Tstring *)a2)->_storage);");
  470. <      f.remove_last(1);
  471. <      m.remove_last(1);
  472. ---
  473. >      pf := f.to_external;
  474. >      pm := m.to_external;
  475. >      c_inline_c("R=(void*)fopen(((char*)_pf),((char*)_pm));");
  476. 70d67
  477. <       alias "fclose"
  478. 71a69,72
  479. >    fputc(c: CHARACTER; stream_pointer: POINTER): CHARACTER is
  480. >       external "C"
  481. >       end;
  482. 72a74,83
  483. >    fgetc(stream_pointer : POINTER): CHARACTER is
  484. >      -- Result is of type CHARACTER because a int is a char !
  485. >       external "C"
  486. >       end;
  487. >    feof(stream_ptr: POINTER): BOOLEAN is
  488. >       do
  489. >      c_inline_c("R=feof((FILE*)C->_input_stream);");
  490. >       end;
  491. diff -r lib_std/std_file.e /users/prof/colnet/SmallEiffel/lib_std/std_file.elib_std/std_file_read.e /users/prof/colnet/SmallEiffel/lib_std/std_file_read.e
  492. 313,323d312
  493. <    
  494. <    fgetc(stream_pointer : POINTER): CHARACTER is
  495. <      -- Result is of type CHARACTER because a int is a char !
  496. <       external "CSE"
  497. <       alias "fgetc"
  498. <       end;
  499. <    
  500. <    feof(stream_ptr: POINTER): BOOLEAN is
  501. <       external "CSE"
  502. <       end;
  503. diff -r lib_std/std_file_read.e /users/prof/colnet/SmallEiffel/lib_std/std_file_read.elib_std/std_file_write.e /users/prof/colnet/SmallEiffel/lib_std/std_file_write.e
  504. 16,17c16
  505. < creation {ANY}
  506. <    connect_to
  507. ---
  508. > creation connect_to
  509. 19c18
  510. < feature {ANY}
  511. ---
  512. > feature 
  513. 38c37
  514. < feature {ANY}   
  515. ---
  516. > feature    
  517. 63c62
  518. <         put_character(s @ i);
  519. ---
  520. >         put_character(s.item(i));
  521. 192,193c191,193
  522. <    fputc(c: CHARACTER; stream_pointer: POINTER): CHARACTER is
  523. <       external "CSE"
  524. ---
  525. >    tmp_string: STRING is
  526. >       once
  527. >      !!Result.make(512);
  528. 195,196d194
  529. <    
  530. <    tmp_string: STRING is "0123456789001234567890";   
  531. diff -r lib_std/std_file_write.e /users/prof/colnet/SmallEiffel/lib_std/std_file_write.elib_std/std_input.e /users/prof/colnet/SmallEiffel/lib_std/std_input.e
  532. 40c40
  533. < feature {NONE} 
  534. ---
  535. > feature {RUN_FEATURE} 
  536. diff -r lib_std/std_input.e /users/prof/colnet/SmallEiffel/lib_std/std_input.elib_std/std_output.e /users/prof/colnet/SmallEiffel/lib_std/std_output.e
  537. 39c39
  538. < feature {NONE}   
  539. ---
  540. > feature {RUN_FEATURE}   
  541. diff -r lib_std/std_output.e /users/prof/colnet/SmallEiffel/lib_std/std_output.elib_std/string.e /users/prof/colnet/SmallEiffel/lib_std/string.e
  542. 13c13,14
  543. <      print_on
  544. ---
  545. >      print_on, fill_tagged_out_memory, eval_read_attribute, 
  546. >      eval_write_attribute
  547. 16,17c17
  548. < creation {ANY}
  549. <    make, copy, blank
  550. ---
  551. > creation make, copy, blank, from_external
  552. 24c24
  553. < feature {ANY}
  554. ---
  555. > feature 
  556. 32c32
  557. < feature {ANY} -- Creation / Modification :
  558. ---
  559. > feature -- Creation / Modification :
  560. 40d39
  561. <      count := 0;
  562. 44,45c43
  563. <           c_inline_c("C->_storage=(char *)%
  564. <                   %malloc((size_t)a1);");
  565. ---
  566. >           storage := malloc(needed_capacity);
  567. 47,48c45
  568. <           c_inline_c("C->_storage=(char *)%
  569. <                  %realloc(C->_storage,(size_t)a1);");
  570. ---
  571. >           storage := realloc(storage,needed_capacity);
  572. 52a50
  573. >      count := 0;
  574. 71c69
  575. < feature {ANY} -- No Modification of the receiver :
  576. ---
  577. > feature -- No Modification of the receiver :
  578. 79c77
  579. <    infix "@", item(index: INTEGER): CHARACTER is
  580. ---
  581. >    item, infix "@" (index: INTEGER): CHARACTER is
  582. 83a82
  583. >      if storage = Void then end;
  584. 112c111
  585. <    infix "<" (other: STRING): BOOLEAN is
  586. ---
  587. >    infix "<" (other: like Current): BOOLEAN is
  588. 170d168
  589. <            Result := false;
  590. 175c173
  591. <           (i = 0) or else (not item(i).same_as(other @ i))
  592. ---
  593. >           (i = 0) or else (not item(i).same_as(other.item(i)))
  594. 184c182
  595. <    is_equal(other: STRING): BOOLEAN is
  596. ---
  597. >    is_equal(other: like Current): BOOLEAN is
  598. 186,187d183
  599. <       require else
  600. <      true
  601. 288c284
  602. < feature {ANY} -- Modification :
  603. ---
  604. > feature -- Modification :
  605. 299c295
  606. <    copy(other: STRING) is
  607. ---
  608. >    copy(other: like Current) is
  609. 304,323c300,301
  610. <      i := other.count;
  611. <      count := i;
  612. <      if i > 0 then
  613. <         if capacity < i then
  614. <            if capacity = 0 then
  615. <           c_inline_c("C->_storage=(char *)%
  616. <                  %malloc((size_t)_i);");
  617. <            else
  618. <           c_inline_c("C->_storage=(char *)%
  619. <                  %realloc(C->_storage,(size_t)_i);");
  620. <            end;
  621. <            capacity := i;
  622. <         end;
  623. <         from
  624. <         until
  625. <            i = 0
  626. <         loop
  627. <            put(other.item(i),i);
  628. <            i := i - 1;
  629. <         end;
  630. ---
  631. >      if capacity < other.count then
  632. >         make(other.count);
  633. 324a303,311
  634. >      from
  635. >         i := other.count;
  636. >         count := i;
  637. >      until
  638. >         i = 0
  639. >      loop
  640. >         put(other.item(i),i);
  641. >         i := i - 1;
  642. >      end;
  643. 356c343
  644. <         extend(other @ i);
  645. ---
  646. >         extend(other.item(i));
  647. 391c378
  648. <         put(other @ i,i);
  649. ---
  650. >         put(other.item(i),i);
  651. 402a390
  652. >      if storage = Void then end;
  653. 509,519c497,503
  654. <      count := count + 1;
  655. <      if capacity < count then
  656. <         if capacity = 0 then
  657. <            capacity := 16;
  658. <            c_inline_c("C->_storage=(char *)%
  659. <                %malloc((size_t)C->_capacity);");
  660. <         else
  661. <            capacity := capacity + 16;
  662. <            c_inline_c("C->_storage=(char *)realloc(%
  663. <               %C->_storage,(size_t)C->_capacity);");
  664. <         end;
  665. ---
  666. >      if capacity > count then
  667. >      elseif capacity = 0 then
  668. >         capacity := 32;
  669. >         storage := malloc(capacity);
  670. >      else
  671. >         capacity := capacity + 32;
  672. >         storage := realloc(storage,capacity);
  673. 520a505
  674. >      count := count + 1;
  675. 642c627
  676. < feature {ANY}   -- Features which don't modify the string
  677. ---
  678. > feature -- Features which don't modify the string
  679. 658c643
  680. < feature {ANY} -- Conversion :
  681. ---
  682. > feature -- Conversion :
  683. 834c819
  684. < feature {ANY} -- Printing :
  685. ---
  686. > feature -- Printing :
  687. 837,838d821
  688. <       local
  689. <      i: INTEGER;
  690. 840,849c823,825
  691. <      file.put_character('%"');
  692. <      from  
  693. <         i := 1;
  694. <      until
  695. <         i > count
  696. <      loop
  697. <         file.put_character(item(i));
  698. <         i := i +1;
  699. <      end;
  700. <      file.put_character('%"');
  701. ---
  702. >            tagged_out_memory.clear;
  703. >      fill_tagged_out_memory;
  704. >      file.put_string(tagged_out_memory);
  705. 852c828,833
  706. < feature {ANY} -- Other features :
  707. ---
  708. >    fill_tagged_out_memory is
  709. >       do
  710. >      tagged_out_memory.extend('%"'); 
  711. >      tagged_out_memory.append(Current); 
  712. >      tagged_out_memory.extend('%"'); 
  713. >       end;
  714. 853a835,836
  715. > feature -- Other features :
  716. >    
  717. 954a938,939
  718. > feature -- Interfacing with C string :
  719. 957,960c942,947
  720. <      -- Gives address of a copy of the contents of the string
  721. <      -- adding null character at end (for C use). 
  722. <      -- NOTE: do a malloc(`count' + 1), thus it is not an access 
  723. <      -- to `storage'.
  724. ---
  725. >      -- Gives C access to the internal storage of STRING.
  726. >      -- To be compatible with C, a null character is always
  727. >      -- appended at the end of internal storage. 
  728. >      -- The added null character is not part of the Eiffel STRING.
  729. >      -- 
  730. >      -- NOTE: do not free/realloc the Result.
  731. 962,964c949,953
  732. <      c_inline_c("R=(char *)malloc((C->_count)+1);%N%
  733. <             %memcpy(R,C->_storage,C->_count);%N%
  734. <             %((char *)R)[C->_count]='\0';");
  735. ---
  736. >      extend('%U');
  737. >      remove_last(1);
  738. >      Result := storage;
  739. >       ensure
  740. >      Result.is_not_void
  741. 966c955,978
  742. <    
  743. ---
  744. >    from_external(p: POINTER) is
  745. >      -- Assume `p' is the addresse of a C string.
  746. >      -- Initialize the string using `p'.
  747. >      -- The null character is not part of the Eiffel STRING.
  748. >       do
  749. >      if storage.is_not_void then
  750. >         free(storage);
  751. >      end;
  752. >      from
  753. >         storage := p;
  754. >         capacity := 1;
  755. >         count := 1;
  756. >      until
  757. >         item(capacity) = '%U'
  758. >      loop
  759. >         capacity := capacity + 1;
  760. >         count := capacity;
  761. >      end;
  762. >      count := count - 1;
  763. >       ensure
  764. >      p = to_external;
  765. >       end;
  766. 969c981,1006
  767. <    tmp_string: STRING is "ABCDEFGHIJKLMN...";
  768. ---
  769. >    tmp_string: STRING is 
  770. >       once
  771. >      !!Result.make(256);
  772. >       end;
  773. > feature {PROC_CALL_1}
  774. >    malloc(size: INTEGER): POINTER is
  775. >       require
  776. >      size > 0
  777. >       do
  778. >      c_inline_c("R=(char*)malloc((size_t)a1);");
  779. >       end;
  780. >    realloc(pointer: POINTER; size: INTEGER): POINTER is
  781. >       require
  782. >      size > 0
  783. >       do
  784. >      c_inline_c("R=(char*)realloc(a1,(size_t)a2);");
  785. >       end;
  786. >    free(p: POINTER) is
  787. >       external "C"
  788. >       end;
  789. > feature
  790. 970a1008,1035
  791. >    eval_read_attribute(name: STRING; dest: POINTER) is
  792. >       do 
  793. >      if ("count").is_equal(name) then
  794. >         eval_virtual_machine.put_integer(dest,count);
  795. >      elseif ("capacity").is_equal(name) then
  796. >         eval_virtual_machine.put_integer(dest,capacity);
  797. >      else
  798. >         check
  799. >            ("storage").is_equal(name)
  800. >         end;
  801. >         eval_virtual_machine.put_pointer(dest,storage);
  802. >      end;
  803. >       end;
  804. >    eval_write_attribute(name: STRING; source: POINTER) is
  805. >       do 
  806. >      if ("count").is_equal(name) then
  807. >         count := eval_virtual_machine.get_integer(source);
  808. >      elseif ("capacity").is_equal(name) then
  809. >         capacity := eval_virtual_machine.get_integer(source);
  810. >      else
  811. >         check
  812. >            ("storage").is_equal(name)
  813. >         end;
  814. >         storage := eval_virtual_machine.get_pointer(source);
  815. >      end;
  816. >       end;
  817. 980d1044
  818.